<template>
  <div class="page-content">
    <div v-wechat-title="$route.meta.title"></div>
    <div class="page-container">
      <div class="text">检测到当天已登录信息:</div>
    </div>
    <div class="container">
      <p class="item">
        <span class="title"
              style="margin-right: 15px;">手机号 :</span>
        <span class="content">{{phone}}</span>
      </p>
      <p class="item">
        <span class="title">登记时间 :</span>
        <span class="content">{{startDate}}</span>
      </p>
    </div>
    <div class="confirm-container">
      <mt-button type="primary"
                 plain
                 class="btn"
                 size="small"
                 @click="repete">重新登记</mt-button>
      <mt-button type="primary"
                 plain
                 class="btn"
                 size="small"
                 @click="quit">签退</mt-button>
    </div>
  </div>
</template>
<script>
import "common/css/form.styl";
import wechat from '@/assets/js/wechat.js';// 跳转微信 获取权限

export default {
  data () {
    return {
      phone: "",
      startDate: ""
    };
  },
  methods: {
    repete () {

      this.$router.push({ name: "visitorRegister" });
    },
    quit () {
      this.$axios.http
        .post({
          funcName: "/fwdj/person/signOut",
          params: {
            dwid: sessionStorage.getItem("openId"),
            openId: sessionStorage.getItem("openId"),
          }
        })
        .then(res => {
          if (res && res.code == "200" || res.code == "502") {

            sessionStorage.setItem("userInfo", JSON.stringify(res.record));

            this.$router.push({ name: "quitSuccessful" });

          } else {
            _that.$public.toast(res.msg);
          }
        });
    }
  },
  mounted () {
    let url = window.location.href;
    wechat.wechatLogin(() => {
      let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
      this.phone = userInfo.sjhm;
      this.startDate = userInfo.djsj;
    }, url);
  }

};
</script>
<style lang="stylus" scoped>
.page-content
  background #ffffff
.page-container
  text-align center
  padding-top 60px
  .text
    color #666
    font-size 18px
    margin-top 10px
.success
  width 65px
  height 65px
.container
  margin 30px 50px
  padding 18px
  border 1px solid #d8d8d8
  border-radius 5px
  .item
    margin-top 10px
    font-size 16px
    color #000
    .content
      margin-left 4px
  .item:first-child
    margin 0
.confirm-container
  margin-top 40px
  .btn
    width 90%
    margin 15px 5%
</style>